<script setup lang="ts">
// 子传父  withDefaults(参数1，{默认值})
//2.定义属性，并接收父组件传值
const props = withDefaults(defineProps<{
    car: string;
    money: number
    house?:string
}>(), {
    house:'市中心顶楼四合院'
}) 
console.log(props.car);
console.log(props.money);
</script>

<template>
  <div class="button">
    子组件
    <!-- 4.调用 -->
    <div>车：{{ car }}</div>
    <div>钱包：{{ money }}</div>
    <div>房子：{{ house }}</div>
  </div>
</template>

<style lang="css" scoped>
.button{
    width: 300px;
    height: 200px;
    background-color: greenyellow;
}
</style>
